import request from "@/utils/request";
// 角色列表查询
export function listAll(data) {
  return request({
    url: "/role/list",
    method: "GET",
    params: { ...data },
  });
}
// 删除角色
export function deleteRole(data) {
  return request({
    url: `/role/delete/${data}`,
    method: "POST",
    data,
  });
}
// 添加角色
export function createRole(data) {
  return request({
    url: "/role/create",
    method: "POST",
    data,
  });
}
// 修改角色
export function updateRole(data) {
  return request({
    url: `/role/update/${data.id}`,
    method: "POST",
    data,
  });
}
// 获取所有权限
export function allResourceRole(data) {
  return request({
    url: `/role/allResource`,
    method: "POST",
    data,
  });
}
// 获取用户列表
export function userList(data) {
  return request({
    url: `/admin/list`,
    method: "GET",
    params: data,
  });
}
// 添加用户
export function registerUser(data) {
  return request({
    url: `/admin/register`,
    method: "POST",
    data,
  });
}
// 修改用户
export function updateUser(data) {
  return request({
    url: `/admin/update/${data.uid}`,
    method: "POST",
    data,
  });
}

// 删除用户
export function deleteUser(id) {
  return request({
    url: `/admin/delete/${id}`,
    method: "POST",
  });
}

// 查询数据字典
export function listWordBook(data) {
  return request({
    url: `/wordBook/listWordBook`,
    method: "GET",
    params: data,
  });
}

// 创建字典
export function createWordBook(data) {
  return request({
    url: `/wordBook/createWordBook`,
    method: "POST",
    data,
  });
}

// 修改字典
export function updateWordBook(data) {
  return request({
    url: `/wordBook/updateWordBook`,
    method: "POST",
    data,
  });
}

// 删除字典
export function deleteWordBook(id) {
  return request({
    url: `/wordBook/deleteWordBook/${id}`,
    method: "POST",
  });
}

//mall-admin/admin/listUsersData/{userId} 查询当前用户数据权限
export function listUsersData(id) {
  return request({
    url: `/admin/listUsersData/${id}`,
    method: "GET",
  });
}
// 给用户分配/mall-admin/admin/allowUsersData
export function allowUsersData(data) {
  return request({
    url: `/admin/allowUsersData`,
    method: "POST",
    data,
  });
}

// /mall-admin/district/list 部门列表
export function districtlist(data) {
  return request({
    url: `/district/list`,
    method: "GET",
    params: data
  });
}
// /mall-admin/district/create
export function districtcreate(data) {
  return request({
    url: `/district/create`,
    method: "POST",
    data,
  });
}

export function districtupdate(data) {
  return request({
    url: `/district/update`,
    method: "POST",
    data,
  });
}

// /mall-admin/district/delete/{id}
export function districtdelete(id) {
  return request({
    url: `/district/delete/${id}`,
    method: "POST",

  });
}